package com.institute.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.institute.entity.dto.PositionDTO;

@Entity
@Table(name="t_position")
public class Position {
	private Long id;
	private String code;
	private String name;
	private Integer capacity;
	private String description;
	private Institute dept;//所属部门
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public String getCode() {
		return code;
	}
	public String getName() {
		return name;
	}
	public Integer getCapacity() {
		return capacity;
	}
	public String getDescription() {
		return description;
	}
	
	public Position(PositionDTO dto) {
		super();
		this.id = dto.getId();
		this.code = dto.getCode();
		this.name = dto.getName();
		this.capacity = dto.getCapacity();
		this.description = dto.getDescription();
	}
	public Position() {
		super();
	}
	@JsonIgnore
	@ManyToOne(cascade=CascadeType.ALL)
	public Institute getDept() {
		return dept;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setCapacity(Integer capacity) {
		this.capacity = capacity;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@JsonIgnore
	@ManyToOne(cascade=CascadeType.ALL)
	public void setDept(Institute dept) {
		this.dept = dept;
	}
	
	
}
